<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
		<title>设置点标注的文本标签</title>
		<link rel="stylesheet" type="text/css" href="../../css/common.css" />
		<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css" />
		<script src="http://webapi.amap.com/maps?v=1.4.4&key=95d86102eed223b780a448ed8afdc8d5"></script>
		<script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
		<link rel="stylesheet" type="text/css" href="../../css/layer.css" />
		<script src="../../js/layer.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div id="iosbox" class="positionR none"></div>
		<header class="positionR colorF height7" style="z-index: 1;">
			<img src="../../img/pinggu_sq/03.png" onclick="window.history.go(-1)" />
			<div class="height30"></div>
			<div class="textC font1-4"></div>
		</header>
		<div id="container"></div>
		<script>
			var ua = navigator.userAgent.toLowerCase();
			var longitude = "";
			var latitude = "";
			if(ua.match(/iPhone\sOS/i) == "iphone os") {
				document.getElementById("iosbox").setAttribute("style", "display: block;height: 18px;background: #698af3;z-index: 1;");
			}

			function getUrlParam(k) {
				var regExp = new RegExp('([?]|&)' + k + '=([^&]*)(&|$)');
				var result = window.location.href.match(regExp);
				if(result) {
					return decodeURIComponent(result[2]);
				} else {
					return "null";
				}
			}
			var jingwei = {
				longitude: getUrlParam("longitude") == "null" ? "121.39" : getUrlParam("longitude"),
				latitude: getUrlParam("latitude") == "null" ? "37.52" : getUrlParam("latitude"),
				name: getUrlParam("name") == "null" ? "" : getUrlParam("name")
			};
			console.log(jingwei)
			var map = new AMap.Map('container', {
				resizeEnable: true,
				center: [jingwei.longitude, jingwei.latitude],
				zoom: 13
			});
			if(getUrlParam("longitude") != "null" && getUrlParam("latitude") != "null") {
				var marker = new AMap.Marker({
					position: map.getCenter()
				});
				marker.setMap(map);
				// 设置label标签
				marker.setLabel({ //label默认蓝框白底左上角显示，样式className为：amap-marker-label
					offset: new AMap.Pixel(20, 20), //修改label相对于maker的位置
					content: jingwei.name
				});
			}
			// 设置鼠标划过点标记显示的文字提示
			// marker.setTitle('我是marker的title');
		</script>
	</body>

</html>